<template>
	<view class="container">
		<view v-for="(item,i) in datalst" :key="item.code">
			<text v-if='item.name!=pageTitle' class="title">{{item.name}}</text>
			<uni-card>
				<text class="center" v-if="!!item.detail" >{{item.detail}}</text>
				<view v-for="(termitem,j) in item.termData">
					<view class="step">{{termitem.name}}</view>
					<text class="center">{{termitem.detail}}</text>
				</view>
			</uni-card>
		</view>
		<view>
			<view class="uni-padding-wrap">
				<view class="uni-btn-v" style='padding:1rem'>
					<button style="background-color: #3796e1" type="primary" class="btn-setstorage"  @tap="getRegisterInfo">立即报名</button>
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
export default {
	data() {
		return {
			baseUrl :'https://www.1xx.online/japx/contextinfo',
			reqid:0,
			pageTitle:'',
			datalst:[]
		};
	},
	onLoad(options) {
		var that = this
		that.reqid = options.headid;
		that.pageTitle = options.name;
		uni.setNavigationBarTitle({
			title:options.name,
		})
		if(!!that.reqid&&that.reqid!="0") that.getListData()
	},
	methods: {
		getRegisterInfo(){
			var that = this
			uni.navigateTo({
				url: '/pages/comm/registerInfo?context_id='+that.reqid
			});
		},
		getListData(){
			var that = this
			uni.request({
				url:that.baseUrl,
				data: JSON.stringify({ params: { 'id':Number(that.reqid)},jsonrpc:'2.0',id:Number(new Date()) }),
				header: {
					'Content-Type': 'application/json'
				},
				method: 'POST',
				dataType: 'json',
				complete: (res) => {
					if(res.statusCode==200){
						var result = res.data.result;
						that.datalst = []
						for(var i=0;i<result.line.length;i++){
							that.datalst.push(result.line[i])	
						}
					}
				}
			})
		}
	}
};
</script>

<style>
page {
	background-color: #edf8fe;
}
.container {
	padding: 20upx;
}
.title {
	display: block;
	text-align: center;
	font-weight: 600;
	font-size: 30upx;
	color: #3a9fe7;
}

.uni-card {
	background-color: #e6f4fd !important;
	border: 1px solid #d8eefc !important;
	box-shadow: 0px 2px 4px 2px #d8eefc !important;
	border-radius: 10upx;
}
.center {
	color: #3a9fe7;
	display: -webkit-box;
	word-break: break-all;
	font-size: 24upx;
	text-align: left;
	/* text-indent: 2em; */
	margin: 20upx 0;
	line-height: 40upx;
}
.step {
	display: inline-block;
	background-color: #0087e3;
	color: #e5f1fd;
	padding: 6upx 30upx;
	font-size: 22upx;
	border-radius: 6upx;
	margin: 30upx 20upx;
}
.disind {
	display: block;
	text-indent: 0;
}
</style>
